#include<cstdio>
using namespace std;
int a[200001],l[200001],r[200001],ans[200001];
int main()
{
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	int n,k,s,gs=0;
	scanf("%d",&n);
	k=n;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		l[i]=i-1;
		r[i]=i+1;
	}
	a[0]=-1;
	r[0]=1;
	while(k!=0)
	{
		s=r[0];
		gs=0;
		while(s<=n)
		{
			if(a[s]!=a[l[s]])
			{
				ans[++gs]=s;
				k--;
			}
			s=r[s];
		}
		for(int i=1;i<=gs;i++)
		{
			printf("%d ",ans[i]);
			l[r[ans[i]]]=l[ans[i]];
			r[l[ans[i]]]=r[ans[i]];
		}
		printf("\n");
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
